<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/WEB-INF/templates/template.xhtml">

	<ui:define name="content">
		<h:form id="CadVoo">

			<p:panel id="Janela" header="Nova Rota Aéria">

				<p:messages id="msgs" />

				<h:panelGrid columns="3">
					<h:outputText for="codigo" value="Codigo* (min. 7) :"></h:outputText>
					<p:inputText id="codigo" value="#{vooController.voo.codigo}" required="true"
						label="Codigo">
						<f:validateLength minimum="7" />
					</p:inputText>
					<p:message for="codigo" display="icon" />


					<h:outputText for="origem" value="Origem:* " />
					<p:selectOneMenu id="origem" value="#{vooController.voo.from}"
						effect="fade" required="true">
						<f:selectItems value="#{vooController.listaAeroportos}" var="aeroporto"
							itemLabel="#{aeroporto.nome}" itemValue="#{aeroporto.codigo}" />
					</p:selectOneMenu>
					<p:message for="origem" display="icon" />

					<h:outputText for="destino" value="Destino:* " />
					<p:selectOneMenu id="destino" value="#{vooController.voo.to}"
						effect="fade" required="true">
						<f:selectItems value="#{vooController.listaAeroportos}" var="aeroporto"
							itemLabel="#{aeroporto.nome}" itemValue="#{aeroporto.codigo}" />
					</p:selectOneMenu>
					<p:message for="destino" display="icon" />

					<h:outputText for="horario" value="Data e hora do voo*:" />
					<p:inputMask id="horario" value="#{vooController.voo.dataFinal}"
						mask="99/99/9999 99:99" required="true" label="Horário" />
					<p:message for="horario" display="icon" />

					<h:outputText for="duracao" value="Duração de voo*:" />
					<p:inputText id="duracao" value="#{vooController.voo.duracao}"
						required="true" label="Duração">
					</p:inputText>
					<p:message for="duracao" display="icon" />

					<h:outputText for="valor" value="Valor*:"></h:outputText>
					<p:inputText id="valor" value="#{vooController.voo.preco.valorFinal}" required="true"
						label="Valor">
						<f:validateLength minimum="4"></f:validateLength>
					</p:inputText>
					<p:message for="valor" display="icon" />

					<h:outputText for="modelo" value="Modelo do avião:"></h:outputText>
					<p:inputText id="modelo" value="#{vooController.voo.aviao.modelo}" />
					<h:outputText value=" "></h:outputText>

					<h:outputText for="maximo"
						value="Quantidade máxima de passageiros*:"></h:outputText>
					<p:inputText id="maximo" value="#{vooController.voo.aviao.capacidade}"
						required="true" label="Quantidade_Passageiros">
						<f:validateLength minimum="2" />
					</p:inputText>
					<p:message for="maximo" display="icon" />

				</h:panelGrid>

				<p:commandButton id="btn" value="Salvar Dados" update="Janela"
					action="#{vooController.insertVoo}" />

			</p:panel>


		</h:form>
	</ui:define>

</ui:composition>
</html>